Class pyglet.text.document.UnformattedDocument

event.EventDispatcher --+    
                        |    
         AbstractDocument --+
                            |
                           UnformattedDocument

A document having uniform style over all text.

Changes to the style of text within the document affects the entire document. For convenience, the position parameters of the style methods may therefore be omitted.

Events

  on_delete_text(self, start, end)
Text was deleted from the document.
(Inherited from pyglet.text.document.AbstractDocument)
  on_insert_text(self, start, text)
Text was inserted into the document.
(Inherited from pyglet.text.document.AbstractDocument)
  on_style_text(self, start, end, attributes)
Text character style was modified.
(Inherited from pyglet.text.document.AbstractDocument)

Methods

  __init__(self, text='')
AbstractRunIterator get_style_runs(self, attribute)
Get a style iterator over the given style attribute.
  get_style(self, attribute, position=None)
Get an attribute style at the given position.
  set_style(self, start, end, attributes)
Set text style of some or all of the document.
  set_paragraph_style(self, start, end, attributes)
Set the style for a range of paragraphs.
AbstractRunIterator get_font_runs(self, dpi=None)
Get a style iterator over the pyglet.font.Font instances used in the document.
pyglet.font.Font get_font(self, position=None, dpi=None)
Get the font instance used at the given position.
  get_element_runs(self)
  delete_text(self, start, end)
Delete text from the document.
(Inherited from pyglet.text.document.AbstractDocument)
  dispatch_event(self, event_type, *args)
Dispatch a single event to the attached handlers.
(Inherited from pyglet.event.EventDispatcher)
  event(self, *args)
Function decorator for an event handler.
(Inherited from pyglet.event.EventDispatcher)
InlineElement get_element(self, position)
Get the element at a specified position.
(Inherited from pyglet.text.document.AbstractDocument)
int get_paragraph_end(self, pos)
Get the end position of a paragraph.
(Inherited from pyglet.text.document.AbstractDocument)
int get_paragraph_start(self, pos)
Get the starting position of a paragraph.
(Inherited from pyglet.text.document.AbstractDocument)
  get_style_range(self, attribute, start, end)
Get an attribute style over the given range.
(Inherited from pyglet.text.document.AbstractDocument)
  insert_element(self, position, element, attributes=None)
Insert a element into the document.
(Inherited from pyglet.text.document.AbstractDocument)
  insert_text(self, start, text, attributes=None)
Insert text into the document.
(Inherited from pyglet.text.document.AbstractDocument)
  pop_handlers(self)
Pop the top level of event handlers off the stack.
(Inherited from pyglet.event.EventDispatcher)
  push_handlers(self, *args, **kwargs)
Push a level onto the top of the handler stack, then attach zero or more event handlers.
(Inherited from pyglet.event.EventDispatcher)
  register_event_type(cls, name)
Register an event type with the dispatcher.
(Inherited from pyglet.event.EventDispatcher)
  remove_handler(self, name, handler)
Remove a single event handler.
(Inherited from pyglet.event.EventDispatcher)
  remove_handlers(self, *args, **kwargs)
Remove event handlers from the event stack.
(Inherited from pyglet.event.EventDispatcher)
  set_handler(self, name, handler)
Attach a single event handler.
(Inherited from pyglet.event.EventDispatcher)
  set_handlers(self, *args, **kwargs)
Attach one or more event handlers to the top level of the handler stack.
(Inherited from pyglet.event.EventDispatcher)

Properties

str text
Document text.
(Inherited from pyglet.text.document.AbstractDocument)

Class Variables

  event_types = ['on_insert_text', 'on_delete_text', 'on_style_t... (Inherited from pyglet.text.document.AbstractDocument)

Method Details

__init__

(Constructor) __init__(self, text='')
Overrides:
AbstractDocument.__init__

get_style_runs

get_style_runs(self, attribute)
Get a style iterator over the given style attribute.
Returns: AbstractRunIterator
Overrides:
AbstractDocument.get_style_runs

get_style

get_style(self, attribute, position=None)
Get an attribute style at the given position.
Returns:
The style set for the attribute at the given position.
Overrides:
AbstractDocument.get_style

set_style

set_style(self, start, end, attributes)
Set text style of some or all of the document.
Overrides:
AbstractDocument.set_style

set_paragraph_style

set_paragraph_style(self, start, end, attributes)

Set the style for a range of paragraphs.

This is a convenience method for set_style that aligns the character range to the enclosing paragraph(s).

Overrides:
AbstractDocument.set_paragraph_style

get_font_runs

get_font_runs(self, dpi=None)

Get a style iterator over the pyglet.font.Font instances used in the document.

The font instances are created on-demand by inspection of the font_name, font_size, bold and italic style attributes.

Returns: AbstractRunIterator
Overrides:
AbstractDocument.get_font_runs

get_font

get_font(self, position=None, dpi=None)
Get the font instance used at the given position.
Returns:
pyglet.font.Font: The font at the given position.
Overrides:
AbstractDocument.get_font

See Also: get_font_runs